
/* magfield.h -- compute local magnetic variation given position,
**               altitude, and date( or GPS week)
**
*/

//Now, IGRF model in this file is updating to IGRF-11 by Miles 09/05/2013



#ifndef IGRFWMM_H
#define IGRFWMM_H

#include "C6747.h"

/* Input: geodetic latitude (radians), longitude (radians) ,height (m), (Julian) date and field model
	model=8: WMM2005, model=9: IGRF2010
	latitude N and longitude E are positive numbers
	
  Output field: Declination(deg), Inclination(deg), Horizontal Intensity(nT), North(+N,-S)(nT), East(+E,-W), Vertical(+D,-U), Total Field
  variation (degrees E positive)
*/

void SGMagVar(double lat, double lon, double h,
			  				 	 	  double dat, double* field);


/* Convert date(yymmdd 130509) to Julian day    2000-2099 */
double yymmdd_to_julian_days(Uint32 yy,Uint32 mm,Uint32 dd);

/* Convert GPS week to Julian day    2000-2099 */
double gpsweek_to_julian_days(Uint32 gps_week, Uint32 gps_msecond_of_week);

#endif
